/*
 * @Description:
 * @Version: 1.0
 * @Author: marshal
 * @Date: 2022-06-11 18:18:05
 * @LastEditors: marshal
 * @LastEditTime: 2022-06-20 14:05:49
 */
#include <stdio.h>

struct square
{
    int length;
    int width;
};

int area(const struct square *); // const protect the original data is not be changed

int main()
{
    struct square square = {20, 10};
    // pass the pointer to function
    struct square *p = &square;
    printf("area : %d\n", area(p)); // area : 200
    return 0;
}

int area(const struct square *p)
{
    return p->length * p->width;
}